import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {
  IncomeMonthlySummaryForm,
  IncomeMonthlySummaryQuery,
  IncomeMonthlySummaryVO
} from '@/api/biz/incomeMonthlySummary/types';

/**
 * 查询月收入汇总列表
 * @param query
 * @returns {*}
 */

export const listMonthlyIncomeSummary = (query?: IncomeMonthlySummaryQuery): AxiosPromise<IncomeMonthlySummaryVO[]> => {
  return request({
    url: '/biz/incomeMonthlySummary/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询月收入汇总详细
 * @param id
 */
export const getMonthlyIncomeSummary = (id: string | number): AxiosPromise<IncomeMonthlySummaryVO> => {
  return request({
    url: '/biz/incomeMonthlySummary/' + id,
    method: 'get'
  });
};

/**
 * 新增月收入汇总
 * @param data
 */
export const addMonthlyIncomeSummary = (data: IncomeMonthlySummaryForm) => {
  return request({
    url: '/biz/incomeMonthlySummary',
    method: 'post',
    data: data
  });
};

/**
 * 修改月收入汇总
 * @param data
 */
export const updateMonthlyIncomeSummary = (data: IncomeMonthlySummaryForm) => {
  return request({
    url: '/biz/incomeMonthlySummary',
    method: 'put',
    data: data
  });
};

/**
 * 删除月收入汇总
 * @param id
 */
export const delMonthlyIncomeSummary = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/incomeMonthlySummary/' + id,
    method: 'delete'
  });
};
